#!/bin/sh
#
# Start the supervisor
#
# 在petalinux 需要防止在/etc/rc5.d 中启动
# 因为petalinux 中/etc/rc5.d 中启动的脚本会在图形界面启动后才执行
# 而supervisor 是需要在图形界面启动前就执行的

case "$1" in
  start)
	printf "Starting supervisor: "
	cd /root/
	# export LD_LIBRARY_PATH=/usr/lib:/home/work/program/km_agent:$LD_LIBRARY_PATH
	/root/supervisor daemon
	
	[ $? = 0 ] && echo "OK" || echo "FAIL"
	;;
  stop)
	printf "Stopping supervisor: "
	killall supervisor
	[ $? = 0 ] && echo "OK" || echo "FAIL"
	;;
  restart|reload)
	"$0" stop
	"$0" start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?

